// Copyright (c) 2007, Brian Duff

// See LICENSE for full license details.

package org.dubh.jdant;

/**
 * Exception thrown when a project is invalid for some reason. This usually
 * indicates that the project is well formed (i.e. can be parsed), but has
 * semantic errors (e.g. refers to libraries that don't exist).
 * 
 * @author brian.duff@dubh.org
 */
public final class InvalidProjectException extends RuntimeException
{
  private final ProjectFile projectFile;
  
  public InvalidProjectException( ProjectFile project, String message )
  {
    super( message );
    this.projectFile = project;
  }

  public InvalidProjectException( ProjectFile project, String message, Throwable cause )
  {
    super( message, cause );
    this.projectFile = project;
  }

  
  public ProjectFile projectFile()
  {
    return projectFile;
  }

  @Override
  public String getMessage()
  {
    return projectFile.name() + ": " + super.getMessage();
  }
}
